//
//  MainTableViewController.swift
//  Animator
//
//  Created by liu guoqiang on 16/9/9.
//  Copyright © 2016年 liu guoqiang. All rights reserved.
//

import UIKit

class MainTableViewController: UITableViewController
{
    let textArray :NSArray = ["重力行为","碰撞行为","吸附行为","推行为","甩行为","动画效果","使用路径","显隐动画","动画块","过渡动画","自定义动画"]
    let detaileTextArray : NSArray = ["UIGravityBehavior","UICollisionBehavior","UIAttachmentBehavior","UIPushBehavior","UISnapBehavior","MotionEffect","UsePath","CoreAnimation","AnimationBlock","Trasition","Custom"]
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "reuseIdentifier")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }

    // MARK: - Table view data source

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return 11
    }

    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = UITableViewCell.init(style: UITableViewCellStyle.Value1, reuseIdentifier: "reuseIdentifier")
         cell.textLabel?.text = self.textArray[indexPath.row] as? String
         cell.detailTextLabel?.text = self.detaileTextArray[indexPath.row] as? String
        // Configure the cell...
        cell.accessoryType=UITableViewCellAccessoryType.DisclosureIndicator;
        return cell
    }
    
    internal override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){
        if indexPath.row == 0 {
          let gravityVC = UIGravityViewController.init()
          self.navigationController?.showViewController(gravityVC, sender: nil)
        }else if indexPath.row == 1{
           let collisonVC = UICollisonViewController.init()
            self.navigationController?.showViewController(collisonVC, sender: nil)
        }else if indexPath.row == 2{
            let attachmentVC = UIAttachmentViewController.init()
            self.navigationController?.showViewController(attachmentVC, sender: nil)
        }else if indexPath.row == 3{
            let pushVC = UIPushViewController.init()
            self.navigationController?.showViewController(pushVC, sender: nil)
        }else if indexPath.row == 4{
            let snapVC = UISnapViewController.init()
            self.navigationController?.showViewController(snapVC, sender: nil)   
        }else if indexPath.row == 5{
            let motionEffectVC = MotionEffectViewController.init()
            self.navigationController?.showViewController(motionEffectVC, sender: nil)
        }else if indexPath.row == 6{
            let pathVC = PathViewController.init()
            self.navigationController?.showViewController(pathVC, sender: nil)
        }else if indexPath.row == 7{
            let explicitVC = ExplicitViewController.init()
            self.navigationController?.showViewController(explicitVC, sender: nil)
        }else if indexPath.row == 8{
            let animateBlockVC = AnimationBlokViewController.init()
            self.navigationController?.showViewController(animateBlockVC, sender: nil)
        }else if indexPath.row == 9{
            let trasitionVC = TrasitionViewController.init()
            self.navigationController?.showViewController(trasitionVC, sender: nil)
        }else if indexPath.row == 10{
            let customVC = CustomViewController.init()
            self.showViewController(customVC, sender: nil)
        }
    }
    
    /*
    // Override to support conditional editing of the table view.
    override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
        // Return false if you do not want the specified item to be editable.
        return true
    }
    */

    /*
    // Override to support editing the table view.
    override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
        if editingStyle == .Delete {
            // Delete the row from the data source
            tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
        } else if editingStyle == .Insert {
            // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
        }    
    }
    */

    /*
    // Override to support rearranging the table view.
    override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {

    }
    */

    /*
    // Override to support conditional rearranging of the table view.
    override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
        // Return false if you do not want the item to be re-orderable.
        return true
    }
    */

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
